package org.chen.spring.cloud.finchley.controller;

import org.chen.spring.cloud.finchley.model.User;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author chensj
 * @date 2020-02-07 20:59
 */
@RestController
@RequestMapping(value = "user")
public class UserController {

    @RequestMapping(value = "/add", method = RequestMethod.GET)
    public String addUser(User user) {
        return "Hello, " + user.getUsername();
    }

    @RequestMapping(value = "/update", method = RequestMethod.POST)
    public String updateUser(@RequestBody User user) {
        return "Hello, " + user.getUsername();
    }
}
